import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    MePageState state, Dispatch dispatch, ViewService viewService) {
  return AnnotatedRegion<SystemUiOverlayStyle>(
    value: SystemUiOverlayStyle.dark,
    child: Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          if (state.isLogined == false)
            RaisedButton(
              child: Text('登录'),
              onPressed: () {
                dispatch(MePageActionCreator.onLogin());
              },
            ),
          if (state.isLogined == true)
            RaisedButton(
              child: Text('退出登录'),
              onPressed: () {
                dispatch(MePageActionCreator.onLogout());
              },
            ),
        ],
      ),
    ),
  );
}
